"""
拦截类的创建过程
"""


class MeMetaClass(type):
    def __new__(cls, class_name, class_bases, class_attrs):
        class_attrs['table_name'] = 'userinfo'
        class_attrs['primary_key'] = 'id'
        return type.__new__(cls, class_name, class_bases, class_attrs)


class User(object, metaclass=MeMetaClass):
    pass


print(User.__dict__)
u = User()
print(u.table_name)
